package tzjz.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tzjz.web.domain.PingLun;
import tzjz.web.mapper.PingLunMapper;
import tzjz.web.service.IPingLunService;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author renshuting
 * @date 2023/8/14 14:34
 */
@Service
public class PingLunServiceImpl extends ServiceImpl<PingLunMapper, PingLun> implements IPingLunService {

    @Resource
    private PingLunMapper pingLunMapper;

    @Override
    public List<PingLun> queryLike(String v) {
        return null;
    }

    @Override
    public List<PingLun> selectList() {
        QueryWrapper<PingLun> queryWrapper=new QueryWrapper<>();
        queryWrapper.lambda().orderByDesc(PingLun::getCreatedOn);
        List<PingLun> list = pingLunMapper.selectList(queryWrapper);
        return list;
    }

    @Override
    public boolean insertPingLun(PingLun pingLun) {
        int insert = pingLunMapper.insert(pingLun);
        if(insert>0) {
            return true;
        }else {
            return false;
        }
    }
}
